﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;

namespace SyncCommon
{
    public class UtilMethod
    {
        public static void OpenWebBrower(string url)
        {
            if (!string.IsNullOrEmpty(url))
            {
                Process p = new Process();
                p.StartInfo = new ProcessStartInfo(url);
                p.Start();
            }
        }

        public static string GetRequestDesc(RequestType requettype)
        {
            switch (requettype)
            {
                case RequestType.Add:
                    return "添加";
                case RequestType.Delete:
                    return "删除";
                case RequestType.Refresh:
                    return "刷新";
                default:
                    return "";
            }
        }

        public static string GetOpStatus(RequestType request, bool isSuccess)
        {
            if (request == RequestType.Add)
            {
                if (isSuccess)
                {
                    return "已添加";
                }
                else
                {
                    return "添加失败";
                }
            }
            if (request == RequestType.Delete)
            {
                if (isSuccess)
                {
                    return "已删除";
                }
                else
                {
                    return "删除失败";
                }
            }
            if (request == RequestType.Refresh)
            {
                if (isSuccess)
                {
                    return "已刷新";
                }
                else
                {
                    return "刷新失败";
                }
            }
            return "";
        }
    }
}
